package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppCarbonDisplayMapper;
import com.ep.modules.app.entity.AppCarbonDisplay;
import com.ep.modules.app.entity.AppCarbonDisplayExample;
import com.ep.modules.app.service.AppCarbonDisplayService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppCarbonDisplayServiceImpl implements AppCarbonDisplayService {
    @Autowired
    private AppCarbonDisplayMapper appCarbonDisplayMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppCarbonDisplayExample example = new AppCarbonDisplayExample();
        AppCarbonDisplayExample.Criteria criteria = example.createCriteria();
        List<AppCarbonDisplay> list = appCarbonDisplayMapper.selectByExample(example);
        Page<AppCarbonDisplay> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppCarbonDisplay getById(Long id) {
        return appCarbonDisplayMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppCarbonDisplay entity) {
        appCarbonDisplayMapper.insert(entity);
    }

    public void update(AppCarbonDisplay entity) {
        appCarbonDisplayMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appCarbonDisplayMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}